package com.jake.xpage.route;

import com.jake.xpage.demos.FullscreenPage;
import com.jake.xpage.demos.TextPage;
import com.jake.xpage.demos.applemusic.AppleMusicMainPage;
import com.jake.xpage.router.XPageRouteMapper;

public class DemoRouteMapper extends XPageRouteMapper {
    public static final String MODULE = "main";

    public DemoRouteMapper() {
        configRoutes();
    }

    protected void configRoutes() {
        register(PageRouteDef.TEXT, (context, route) -> {
            TextPage page = new TextPage(context);
            page.setArgument(route.argument);
            return page;
        });
        register(PageRouteDef.APPLE_MUSIC, (context, route) -> {
            AppleMusicMainPage page = new AppleMusicMainPage(context);
            page.setArgument(route.argument);
            return page;
        });
        register(PageRouteDef.FULLSCREEN, (context, route) -> {
            FullscreenPage page = new FullscreenPage(context);
            page.setArgument(route.argument);
            return page;
        });
    }

    @Override
    public String moduleName() {
        return MODULE;
    }
}
